<div class="reference">
   <div class="titlepage">
      <div>
         <h1 class="title"><a name="d4e1"></a>Date/Time Processing
         </h1>
      </div>
      <div>
         <h3 class="author">Jason Diamond</h3>
      </div>
      <div>
         <p class="releaseinfo">
            $Id: date-time.html,v 1.6 2001/11/03 00:50:28 balls Exp $
                  
         </p>
      </div>
      <div>
         <p class="copyright">Copyright &copy; 2001 Jason Diamond</p>
      </div>
      <hr>
   </div>
   <div class="partintro">
      <div></div>
      <div class="section"><a name="d4e22"></a><div class="titlepage">
            <div>
               <h2 class="title" style="clear: both"><a name="d4e22"></a>Introduction
               </h2>
            </div>
         </div>
         <p>This module provides templates for formatting and parsing date/time strings.</p>
         <p>See <a href="http://www.tondering.dk/claus/calendar.html" target="_top">http://www.tondering.dk/claus/calendar.html</a> for more information on calendars and the calculations this library performs.
         </p>
      </div>
      <div class="toc">
         <p><b>Table of Contents</b></p>
         <dl>
            <dt><a href="#template.dt:format-date-time">dt:format-date-time</a> - Returns a string with a formatted date/time.
            </dt>
            <dt><a href="#template.dt:calculate-day-of-the-week">dt:calculate-day-of-the-week</a> - Calculates the day of the week.
            </dt>
            <dt><a href="#template.dt:get-day-of-the-week-name">dt:get-day-of-the-week-name</a> - Gets the day of the week's full name.
            </dt>
            <dt><a href="#template.dt:get-day-of-the-week-abbreviation">dt:get-day-of-the-week-abbreviation</a> - Gets the day of the week's abbreviation.
            </dt>
            <dt><a href="#template.dt:get-month-name">dt:get-month-name</a> - Gets the month's full name.
            </dt>
            <dt><a href="#template.dt:get-month-abbreviation">dt:get-month-abbreviation</a> - Gets the month's abbreviation.
            </dt>
            <dt><a href="#template.dt:calculate-julian-day">dt:calculate-julian-day</a> - Calculates the Julian Day for a specified date.
            </dt>
            <dt><a href="#template.dt:format-julian-day">dt:format-julian-day</a> - Returns a string with a formatted date for a specified Julian Day.
            </dt>
            <dt><a href="#template.dt:calculate-week-number">dt:calculate-week-number</a> - Calculates the week number for a specified date.
            </dt>
         </dl>
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:format-date-time"></a>dt:format-date-time
      </h1>
      <div class="refnamediv"><a name="d4e33"></a><h2>Name</h2>dt:format-date-time &#8212; Returns a string with a formatted date/time.
      </div>
      <div class="refsynopsisdiv"><a name="d4e38"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:format-date-time"&gt;
&lt;xsl:param name="year"/&gt;
&lt;xsl:param name="month"/&gt;
&lt;xsl:param name="day"/&gt;
&lt;xsl:param name="hour"/&gt;
&lt;xsl:param name="minute"/&gt;
&lt;xsl:param name="second"/&gt;
&lt;xsl:param name="time-zone"/&gt;
&lt;xsl:param name="format" select="'%Y-%m-%dT%H:%M:%S%z'"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e41"></a>
               
         
         <p>The formatted date/time is determined by the format parameter. The default format is %Y-%m-%dT%H:%M:%S%z, the W3C format.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e46"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e49"></a><span class="term">year</span></dt>
               <dd>
                  <p><a name="d4e52"></a>Year
                  </p>
               </dd>
               <dt><a name="d4e55"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e58"></a>Month (1 - 12; January = 1)
                  </p>
               </dd>
               <dt><a name="d4e61"></a><span class="term">day</span></dt>
               <dd>
                  <p><a name="d4e64"></a>Day of month (1 - 31)
                  </p>
               </dd>
               <dt><a name="d4e67"></a><span class="term">hour</span></dt>
               <dd>
                  <p><a name="d4e70"></a>Hours since midnight (0 - 23)
                  </p>
               </dd>
               <dt><a name="d4e73"></a><span class="term">minute</span></dt>
               <dd>
                  <p><a name="d4e76"></a>Minutes after hour (0 - 59)
                  </p>
               </dd>
               <dt><a name="d4e79"></a><span class="term">second</span></dt>
               <dd>
                  <p><a name="d4e82"></a>Seconds after minute (0 - 59)
                  </p>
               </dd>
               <dt><a name="d4e85"></a><span class="term">time-zone</span></dt>
               <dd>
                  <p><a name="d4e88"></a>Time zone string (e.g., 'Z' or '-08:00')
                  </p>
               </dd>
               <dt><a name="d4e91"></a><span class="term">format</span></dt>
               <dd>
                  <p><a name="d4e94"></a>The format specification.
                  </p>
                  <div class="variablelist">
                     <dl>
                        <dt><a name="d4e98"></a><span class="term">%a</span></dt>
                        <dd>
                           <p><a name="d4e101"></a>Abbreviated weekday name
                           </p>
                        </dd>
                        <dt><a name="d4e104"></a><span class="term">%A</span></dt>
                        <dd>
                           <p><a name="d4e107"></a>Full weekday name
                           </p>
                        </dd>
                        <dt><a name="d4e110"></a><span class="term">%b</span></dt>
                        <dd>
                           <p><a name="d4e113"></a>Abbreviated month name
                           </p>
                        </dd>
                        <dt><a name="d4e116"></a><span class="term">%B</span></dt>
                        <dd>
                           <p><a name="d4e119"></a>Full month name
                           </p>
                        </dd>
                        <dt><a name="d4e122"></a><span class="term">%c</span></dt>
                        <dd>
                           <p><a name="d4e125"></a>Date and time representation appropriate for locale
                           </p>
                        </dd>
                        <dt><a name="d4e128"></a><span class="term">%d</span></dt>
                        <dd>
                           <p><a name="d4e131"></a>Day of month as decimal number (01 - 31)
                           </p>
                        </dd>
                        <dt><a name="d4e134"></a><span class="term">%H</span></dt>
                        <dd>
                           <p><a name="d4e137"></a>Hour in 24-hour format (00 - 23)
                           </p>
                        </dd>
                        <dt><a name="d4e140"></a><span class="term">%I</span></dt>
                        <dd>
                           <p><a name="d4e143"></a>Hour in 12-hour format (01 - 12)
                           </p>
                        </dd>
                        <dt><a name="d4e146"></a><span class="term">%j</span></dt>
                        <dd>
                           <p><a name="d4e149"></a>Day of year as decimal number (001 - 366)
                           </p>
                        </dd>
                        <dt><a name="d4e152"></a><span class="term">%m</span></dt>
                        <dd>
                           <p><a name="d4e155"></a>Month as decimal number (01 - 12)
                           </p>
                        </dd>
                        <dt><a name="d4e158"></a><span class="term">%M</span></dt>
                        <dd>
                           <p><a name="d4e161"></a>Minute as decimal number (00 - 59)
                           </p>
                        </dd>
                        <dt><a name="d4e164"></a><span class="term">%p</span></dt>
                        <dd>
                           <p><a name="d4e167"></a>Current locale's A.M./P.M. indicator for 12-hour clock
                           </p>
                        </dd>
                        <dt><a name="d4e170"></a><span class="term">%S</span></dt>
                        <dd>
                           <p><a name="d4e173"></a>Second as decimal number (00 - 59)
                           </p>
                        </dd>
                        <dt><a name="d4e176"></a><span class="term">%U</span></dt>
                        <dd>
                           <p><a name="d4e179"></a>Week of year as decimal number, with Sunday as first day of week (00 - 53)
                           </p>
                        </dd>
                        <dt><a name="d4e182"></a><span class="term">%w</span></dt>
                        <dd>
                           <p><a name="d4e185"></a>Weekday as decimal number (0 - 6; Sunday is 0)
                           </p>
                        </dd>
                        <dt><a name="d4e188"></a><span class="term">%W</span></dt>
                        <dd>
                           <p><a name="d4e191"></a>Week of year as decimal number, with Monday as first day of week (00 - 53)
                           </p>
                        </dd>
                        <dt><a name="d4e194"></a><span class="term">%x</span></dt>
                        <dd>
                           <p><a name="d4e197"></a>Date representation for current locale 
                           </p>
                        </dd>
                        <dt><a name="d4e200"></a><span class="term">%X</span></dt>
                        <dd>
                           <p><a name="d4e203"></a>Time representation for current locale
                           </p>
                        </dd>
                        <dt><a name="d4e206"></a><span class="term">%y</span></dt>
                        <dd>
                           <p><a name="d4e209"></a>Year without century, as decimal number (00 - 99)
                           </p>
                        </dd>
                        <dt><a name="d4e212"></a><span class="term">%Y</span></dt>
                        <dd>
                           <p><a name="d4e215"></a>Year with century, as decimal number
                           </p>
                        </dd>
                        <dt><a name="d4e218"></a><span class="term">%z</span></dt>
                        <dd>
                           <p><a name="d4e221"></a>Time-zone name or abbreviation; no characters if time zone is unknown
                           </p>
                        </dd>
                        <dt><a name="d4e224"></a><span class="term">%%</span></dt>
                        <dd>
                           <p><a name="d4e227"></a>Percent sign
                           </p>
                        </dd>
                     </dl>
                  </div>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e231"></a>Returns</b>
               
         
         <p>Returns a formatted date/time string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:calculate-day-of-the-week"></a>dt:calculate-day-of-the-week
      </h1>
      <div class="refnamediv"><a name="d4e237"></a><h2>Name</h2>dt:calculate-day-of-the-week &#8212; Calculates the day of the week.
      </div>
      <div class="refsynopsisdiv"><a name="d4e242"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:calculate-day-of-the-week"&gt;
&lt;xsl:param name="year"/&gt;
&lt;xsl:param name="month"/&gt;
&lt;xsl:param name="day"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e245"></a>
               
         
         <p>Given any Gregorian date, this calculates the day of the week.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e250"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e253"></a><span class="term">year</span></dt>
               <dd>
                  <p><a name="d4e256"></a>Year
                  </p>
               </dd>
               <dt><a name="d4e259"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e262"></a>Month (1 - 12; January = 1)
                  </p>
               </dd>
               <dt><a name="d4e265"></a><span class="term">day</span></dt>
               <dd>
                  <p><a name="d4e268"></a>Day of month (1 - 31)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e272"></a>Returns</b>
               
         
         <p>Returns the day of the week (0 - 6; Sunday = 0).</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:get-day-of-the-week-name"></a>dt:get-day-of-the-week-name
      </h1>
      <div class="refnamediv"><a name="d4e278"></a><h2>Name</h2>dt:get-day-of-the-week-name &#8212; Gets the day of the week's full name.
      </div>
      <div class="refsynopsisdiv"><a name="d4e283"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:get-day-of-the-week-name"&gt;
&lt;xsl:param name="day-of-the-week"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e286"></a>
               
         
         <p>Converts a numeric day of the week value into a string representing the day's full name.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e291"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e294"></a><span class="term">day-of-the-week</span></dt>
               <dd>
                  <p><a name="d4e297"></a>Day of the week (0 - 6; Sunday = 0)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e301"></a>Returns</b>
               
         
         <p>Returns a string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:get-day-of-the-week-abbreviation"></a>dt:get-day-of-the-week-abbreviation
      </h1>
      <div class="refnamediv"><a name="d4e307"></a><h2>Name</h2>dt:get-day-of-the-week-abbreviation &#8212; Gets the day of the week's abbreviation.
      </div>
      <div class="refsynopsisdiv"><a name="d4e312"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:get-day-of-the-week-abbreviation"&gt;
&lt;xsl:param name="day-of-the-week"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e315"></a>
               
         
         <p>Converts a numeric day of the week value into a string representing the day's abbreviation.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e320"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e323"></a><span class="term">day-of-the-week</span></dt>
               <dd>
                  <p><a name="d4e326"></a>Day of the week (0 - 6; Sunday = 0)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e330"></a>Returns</b>
               
         
         <p>Returns a string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:get-month-name"></a>dt:get-month-name
      </h1>
      <div class="refnamediv"><a name="d4e336"></a><h2>Name</h2>dt:get-month-name &#8212; Gets the month's full name.
      </div>
      <div class="refsynopsisdiv"><a name="d4e341"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:get-month-name"&gt;
&lt;xsl:param name="month"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e344"></a>
               
         
         <p>Converts a numeric month value into a string representing the month's full name.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e349"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e352"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e355"></a>Month (1 - 12; Januaray = 1)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e359"></a>Returns</b>
               
         
         <p>Returns a string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:get-month-abbreviation"></a>dt:get-month-abbreviation
      </h1>
      <div class="refnamediv"><a name="d4e365"></a><h2>Name</h2>dt:get-month-abbreviation &#8212; Gets the month's abbreviation.
      </div>
      <div class="refsynopsisdiv"><a name="d4e370"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:get-month-abbreviation"&gt;
&lt;xsl:param name="month"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e373"></a>
               
         
         <p>Converts a numeric month value into a string representing the month's abbreviation.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e378"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e381"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e384"></a>Month (1 - 12; Januaray = 1)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e388"></a>Returns</b>
               
         
         <p>Returns a string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:calculate-julian-day"></a>dt:calculate-julian-day
      </h1>
      <div class="refnamediv"><a name="d4e394"></a><h2>Name</h2>dt:calculate-julian-day &#8212; Calculates the Julian Day for a specified date.
      </div>
      <div class="refsynopsisdiv"><a name="d4e399"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:calculate-julian-day"&gt;
&lt;xsl:param name="year"/&gt;
&lt;xsl:param name="month"/&gt;
&lt;xsl:param name="day"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e402"></a>
               
         
         <p>Given any Gregorian date, this calculates the Julian Day.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e407"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e410"></a><span class="term">year</span></dt>
               <dd>
                  <p><a name="d4e413"></a>Year
                  </p>
               </dd>
               <dt><a name="d4e416"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e419"></a>Month (1 - 12; January = 1)
                  </p>
               </dd>
               <dt><a name="d4e422"></a><span class="term">day</span></dt>
               <dd>
                  <p><a name="d4e425"></a>Day of month (1 - 31)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e429"></a>Returns</b>
               
         
         <p>Returns the Julian Day as a decimal number.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:format-julian-day"></a>dt:format-julian-day
      </h1>
      <div class="refnamediv"><a name="d4e435"></a><h2>Name</h2>dt:format-julian-day &#8212; Returns a string with a formatted date for a specified Julian Day.
      </div>
      <div class="refsynopsisdiv"><a name="d4e440"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:format-julian-day"&gt;
&lt;xsl:param name="julian-day"/&gt;
&lt;xsl:param name="format" select="'%Y-%m-%d'"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e443"></a>
               
         
         <p>Given any Julian Day, this returns a string according to the format specification.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e448"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e451"></a><span class="term">julian-day</span></dt>
               <dd>
                  <p><a name="d4e454"></a>A Julian Day
                  </p>
               </dd>
               <dt><a name="d4e457"></a><span class="term">format</span></dt>
               <dd>
                  <p><a name="d4e460"></a>The format specification. See dt:format-date-time for more details.
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e464"></a>Returns</b>
               
         
         <p>A string.</p>
         
             
      </div>
   </div>
   <hr>
   <div class="refentry">
      <h1 class="title"><a name="template.dt:calculate-week-number"></a>dt:calculate-week-number
      </h1>
      <div class="refnamediv"><a name="d4e470"></a><h2>Name</h2>dt:calculate-week-number &#8212; Calculates the week number for a specified date.
      </div>
      <div class="refsynopsisdiv"><a name="d4e475"></a><h2>Synopsis</h2><pre class="synopsis">&lt;xsl:template name="dt:calculate-week-number"&gt;
&lt;xsl:param name="year"/&gt;
&lt;xsl:param name="month"/&gt;
&lt;xsl:param name="day"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
      <div class="refdescription"><a name="d4e478"></a>
               
         
         <p>Assumes Monday is the first day of the week.</p>
         
             
      </div>
      <div class="refparameter"><b><a name="d4e483"></a>Parameters</b>
               
         
         <div class="variablelist">
            <dl>
               <dt><a name="d4e486"></a><span class="term">year</span></dt>
               <dd>
                  <p><a name="d4e489"></a>Year
                  </p>
               </dd>
               <dt><a name="d4e492"></a><span class="term">month</span></dt>
               <dd>
                  <p><a name="d4e495"></a>Month (1 - 12; January = 1)
                  </p>
               </dd>
               <dt><a name="d4e498"></a><span class="term">day</span></dt>
               <dd>
                  <p><a name="d4e501"></a>Day of month (1 - 31)
                  </p>
               </dd>
            </dl>
         </div>
         
             
      </div>
      <div class="refreturn"><b><a name="d4e505"></a>Returns</b>
               
         
         <p>Returns the week number as a decimal number.</p>
         
             
      </div>
   </div>
</div>